package com.chatplus.application.controller.api;

import cn.dev33.satoken.annotation.SaIgnore;
import com.chatplus.application.common.logging.SouthernQuietLogger;
import com.chatplus.application.common.logging.SouthernQuietLoggerFactory;
import com.chatplus.application.domain.dto.AdminConfigDto;
import com.chatplus.application.service.basedata.ConfigService;
import com.chatplus.application.web.basecontroller.BaseController;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * 系统配置
 */
@Validated
@RestController
@RequestMapping("/api/admin/config")
@Tag(name = "邀请API", description = "邀请API")
public class ConfigApiController extends BaseController {
    static final SouthernQuietLogger LOGGER = SouthernQuietLoggerFactory.getLogger(ConfigApiController.class);
    private final ConfigService configService;

    public ConfigApiController(ConfigService configService) {
        this.configService = configService;
    }

    @GetMapping("get")
    @Operation(summary = "获取后台配置")
    @SaIgnore
    public AdminConfigDto get(@RequestParam(value = "key") String key) {
        return configService.getSystemConfig();
    }
}
